﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;

namespace FairyWorld.Models
{
    public class User
    {
        public int UserId { get; set; }
        [Required]
        [Display(Name = "用户名")]
        public string username { get; set; }
        [Required]
        [StringLength(100, ErrorMessage = "{0} 必须至少包含 {2} 个字符。", MinimumLength = 5)]
        [DataType(DataType.Password)]
        [Display(Name = "新密码")]
        public string password { get; set; }
        public string iconUrl { get; set; }
 //       [Display(Name = "电话号码")]
        [RegularExpression(@"\+?[0-9]+-?[0-9]+", ErrorMessage = "电话号码不合法")]
        public string phone { get; set; }
        [Required]
        [DataType(DataType.EmailAddress)]
        [Display(Name = "电子邮件地址")]
        [RegularExpression(@"[A-Za-z0-9._%+-]+@[A-Za-z0-9]+\.[A-Za-z]{2,4}", ErrorMessage = "电子邮件不合法")]
        public string email { get; set; }
        public string createTime { get; set; }
        public Fold fold { get; set; }
        public List<Role> roles { get; set; }
        public List<Letter> letters { get; set; }
        public List<Logs> logs { get; set; }
        [DataType(DataType.Password)]
        [Display(Name = "确认密码")]
        [System.Web.Mvc.Compare("password", ErrorMessage = "密码和确认密码不匹配。")]
        public string ConfirmPassword { get; set; }
    }
}